/**
 * method to access buttonTag
 */
package com.dcivision.framework.taglib.utility;

import java.io.IOException;
import java.io.StringWriter;
import java.io.Writer;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.tagext.BodyContent;

import com.dcivision.framework.taglib.html.StandardButtonTag;

public class ButtonUtility {

  public static String getButtonContent(StandardButtonTag button,PageContext pageContext) throws IOException, JspException{
    button.setPageContext(pageContext);
    Writer buttonTagOut = new StringWriter();
    BodyContent bodyContent = pageContext.pushBody();
    button.doStartTag();
    button.doEndTag();
    button.release();
    pageContext.popBody();
    bodyContent.writeOut(buttonTagOut);
    return buttonTagOut.toString();
  }
}
